# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=telepathy-glib
pkgver=0.24.2
pkgrel=2
pkgdesc="Library for GLib-based Telepathy components"
url="https://telepathy.freedesktop.org"
arch="all"
license="LGPL-2.1-or-later"
makedepends="dbus-glib-dev intltool libxslt python3 glib-dev diffutils vala
	gobject-introspection-dev automake autoconf gtk-doc"
checkdepends="dbus"
subpackages="$pkgname-dev $pkgname-doc"
source="https://telepathy.freedesktop.org/releases/telepathy-glib/telepathy-glib-$pkgver.tar.gz
	test-cm.patch
	"

case "$CARCH" in
s390x)
	# hang forever
	options="$options !check"
	;;
esac

prepare() {
	default_prepare
	env LANG=C grep -rl python . | \
		xargs sed -i \
			-e 's|/usr/bin/python$|/usr/bin/python3|'  \
			-e 's|/usr/bin/env[ \t]*python$|/usr/bin/python3|'

	autoreconf -fi
}

build() {
	export PYTHON=python3
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-vala-bindings
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
736590c299b6522c41153e01e80d9bfdac1d4cbec646b28c9fba67a07429426ff2c8e38818f2cddd7ccdc38a061d210906f6e551f7a6059c34c4dd08b789b501  telepathy-glib-0.24.2.tar.gz
779ae9628367f25aeb6a3c3322ef5e14f7c4271ba592f42e9c4bd82235a2bf767f8fea6ef13d61c746eb1719bf8e74c54c8f4da6d170496a595b5c4b96a39c5d  test-cm.patch
"
